Skip to content

petri: make Windows image preparation independent of disk discovery order - #5068

Open
Maheer Aeron (maheeraeron) wants to merge 1 commit into
microsoft:mainfrom
maheeraeron:user/maheeraeron/lock-petri-drive-order
Open

Maheer Aeron (maheeraeron) wants to merge 1 commit into
microsoft:mainfrom
maheeraeron:user/maheeraeron/lock-petri-drive-order

Conversation

@maheeraeron

@maheeraeron Maheer Aeron (maheeraeron) commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Boot the preparation VM and wait for pipette before hot-attaching the target disk. This prevents firmware from booting the target and avoids it competing with the agent disk for drive letters during initial boot.

Wait up to 30 seconds for the target Windows volume at E: before preparing it. Existing drive-letter assumptions remain unchanged. Validated with fresh prep and a passing no-VMBus boot test using previously problematic Patina firmware.

@maheeraeron
Maheer Aeron (maheeraeron) requested a review from a team as a code owner November 12, 2026 23:03
Copilot AI balanced review requested due to automatic review settings November 12, 2026 23:03
@github-actions github-actions Bot added the unsafe Related to unsafe code label Nov 12, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Unsafe Code Detected

This PR modifies files containing unsafe Rust code. Extra scrutiny is required during review.

For more on why we check whole files, instead of just diffs, check out the Rustonomicon

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues for the Windows image-preparation changes.

No open issues 🎉

What changed in this PR

Makes Petri’s Windows image preparation independent of disk discovery order, preventing accidental target boots and ensuring preparation modifies the intended Windows volume.

Changes:

  • Assigns the Windows agent partition a stable GUID and reserves D: through the IMC hive.
  • Boots the source image before attaching the target, then discovers the target Windows volume by GPT disk GUID.
  • Uses the discovered drive for offline updates and copies the agent’s mount mapping into the prepared image.
File Description
vmm_tests/​prep_steps/​src/​main.rs Delays target attachment, discovers its drive, and updates offline preparation paths and mount mappings.
vmm_tests/​prep_steps/​Cargo.toml Adds Mesh support for disk attachment requests.
petri/​src/​vm/​hyperv/​mod.rs Keeps crash-disk partition GUID generation unchanged with the updated helper.
petri/​src/​disk_image.rs Supports explicit partition GUIDs and uses the stable identity for Windows agent disks.
petri/​petri_artifacts_common/​src/​windows_agent.rs Defines the shared Windows agent partition GUID.
petri/​petri_artifacts_common/​src/​lib.rs Exposes the Windows agent identity module.
petri/​petri_artifacts_common/​Cargo.toml Adds the GUID dependency.
petri/​make_imc_hive/​src/​windows/​offreg.rs Adds binary registry-value writing support.
petri/​make_imc_hive/​src/​windows/​mod.rs Maps the agent partition to D: in the IMC hive.
petri/​make_imc_hive/​Cargo.toml Adds access to the shared agent partition identity.
Cargo.lock Records the updated workspace dependencies.

Review effort: Balanced

Comment thread vmm_tests/prep_steps/src/main.rs Resolved
Comment thread vmm_tests/prep_steps/src/main.rs Resolved
@maheeraeron
Maheer Aeron (maheeraeron) force-pushed the user/maheeraeron/lock-petri-drive-order branch from 25604cd to 3243126 Compare November 13, 2026 00:02
Copilot AI balanced review requested due to automatic review settings November 13, 2026 00:02
@github-actions github-actions Bot removed the unsafe Related to unsafe code label Nov 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Hard-coded E: paths can cause preparation to time out for targets mounted elsewhere, and the missing persistent D: mapping leaves subsequent pipette startup dependent on drive-letter assignment.

2 open issues

Review effort: Balanced

Comment thread vmm_tests/prep_steps/src/main.rs Resolved
Comment thread vmm_tests/prep_steps/src/main.rs Resolved
@github-actions

Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this happen at some point?

@maheeraeron

Copy link
Copy Markdown
Contributor Author

Did this happen at some point?

Looks like this happened? But never again:

Microsoft-Windows-Hyper-V-Chipset: (2, 18620) 'multiarch::tpm138::hyperv_openhcl_uefi_x64_windows_datacenter_core_2025_x64_prepped_vbs_cvm_guest' failed in the management VTL before starting guest VTL0: . (Virtual machine ID E3198FD0-B134-493A-8AB7-DAD14BEA66CA) (multiarch::tpm138::hyperv_openhcl_uefi_x64_windows_datacenter_core_2025_x64_prepped_vbs_cvm_guest,E3198FD0-B134-493A-8AB7-DAD14BEA66CA,%%3224832010,0xC037080A,4294967295,)

Steven Malis (@smalis-msft)

@tjones60

Copy link
Copy Markdown
Contributor

I feel like there is probably a better way to do this, but if this works (which it seems to) I'm ok with this for now since it is a relatively simple change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants